list comprehension
MetPy Mondays `#34 - List Comprehensions : Unidata Developer's Blog code:python
code:python
# for a in b:
# flattened.append(a)
They provide a syntactically more compact and more efficient way of writing the above for loop:
code:python
instead of
code:python
newlist = []
for word in oldlist:
newlist.append(word.upper())
filter
code:python
print(even)
Totorials
(Tutorial) Python List Comprehension - DataCamp
Tips
code:python
import dask
dtemp=[dask.delayed(f)n for n in range(M)] dask.compute(*dtemp)
Do not overuse it